package de.wiv.tapestryportlet2.pages;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.tapestry5.StreamResponse;
import org.apache.tapestry5.services.Response;

public class Contact {

    // TODO: this is not working at the moment.
    //       it's triggered during a RenderRequest, which is supposed to render the portlet and NOT to return any binary data.
    //       not sure what would be a proper solution...
    public Object onActivate() {

        return new StreamResponse() {

            @Override
            public String getContentType() {
                // TODO Auto-generated method stub
                return "application/zip";
            }

            @Override
            public InputStream getStream() throws IOException {
                return new ByteArrayInputStream(new String("hellohello").getBytes());
            }

            @Override
            public void prepareResponse(Response arg0) {
                // TODO Auto-generated method stub

            }

        };
    }
}
